﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SqlMiM.SqlIndexes.Model
{
    public class PotentialIndex
    {

        private Byte potentialPctGainUserImpactLevel;

        public Int32 DatabaseId { get; set; }

        public String DatabaseName { get; set; }


        public String DatabaseSchemaTable { get; set; }

        public String IndexedColumns { get; set; }

        public String IncludedColumns { get; set; }

        public long PotentialUserSeeks { get; set; }

        public DateTime? PotentialLastUserSeek { get; set; }

        public long PotentialUserScans { get; set; }

        public DateTime? PotentialLastUserScan { get; set; }

        public Int32 PotentialImpact { get; set; }

        public Double PotentialReducedAvgUserCost { get; set; }

        public Double PotentialPctGainUserImpact { get; set; }

        public byte PotentialPctGainUserImpactLevel
        {
            get
            {
                if (this.PotentialReducedAvgUserCost <= 30d)
                    potentialPctGainUserImpactLevel = 3;
                else if (this.PotentialReducedAvgUserCost > 30d && this.PotentialReducedAvgUserCost <= 60d)
                    potentialPctGainUserImpactLevel = 2;
                else
                    potentialPctGainUserImpactLevel = 1;

                return potentialPctGainUserImpactLevel;
            }

        }
    }
}
